<?php
/* -------------------------------------------------------------------------------------
* 	fork by itDOT Media - dirk mueller
* 	http://www.itdotmedia.de
*
* 	SEO:mercari by Siekiera Media
* 	http://www.seo-mercari.de
*
* 	Copyright (c) since 2011 SEO:mercari
* --------------------------------------------------------------------------------------
* 	based on:
* 	(c) 2000-2001 The Exchange Project  (earlier name of osCommerce)
* 	(c) 2002-2003 osCommerce - www.oscommerce.com
* 	(c) 2003     nextcommerce - www.nextcommerce.org
* 	(c) 2005     xt:Commerce - www.xt-commerce.com
*
* 	Released under the GNU General Public License
* ----------------------------------------------------------------------------------- */
function get_age($dob) {
  $iDiffYear  = date('Y') - date('Y', $dob);
  $iDiffMonth = date('n') - date('n', $dob);
  $iDiffDay   = date('j') - date('j', $dob);
  
  // If birthday has not happen yet for this year, subtract 1.
  if ($iDiffMonth < 0 || ($iDiffMonth == 0 && $iDiffDay < 0)) {
      $iDiffYear--;
  }
      
  return $iDiffYear;
}  